package org.apache.android.media;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.widget.ProgressBar;

public class ProgressSampleActivity extends Activity {

//	private MyProgressDialog mProgress;
	private static final int PROGRESS = 0x1;

	private ProgressBar mProgress;
	private int mProgressStatus = 0;

	private Handler mHandler = new Handler();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
		
		setContentView(R.layout.main1);
		setProgressBarIndeterminateVisibility(true);
	    
			
	    
		mProgress = (ProgressBar) findViewById(R.id.progressBar1);
		new Thread(new Runnable() {
			public void run() {
				while (mProgressStatus < 100) {
					try {
						Thread.sleep(1000);
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					mProgressStatus +=5;

					// Update the progress bar
					mHandler.post(new Runnable() {
						public void run() {
							mProgress.setProgress(mProgressStatus);
//							setProgress(0);
													
						}
					});
				}
			}
		}).start();
		// mProgress = MyProgressDialog.show(this, null, null);

		// try {
		// Thread.sleep(10000);
		// mProgress.dismiss();
		// } catch (InterruptedException e) {
		// // TODO Auto-generated catch block
		// e.printStackTrace();
		// }

	}
	
	
	
}
